package com.webtair.dump4j.algorithm;

import java.lang.reflect.Field;
import java.lang.reflect.Modifier;

public class PropertiesExtractorImplPublic extends PropertiesExtractorImpl{

	@Override
	protected boolean shouldSkip(Field field) {
		if(field.isAccessible()||Modifier.isPublic(field.getModifiers()))
			return false;
		Class cl = field.getDeclaringClass();
		String getterName = "get"; 
		String fieldName = field.getName();
		getterName+=fieldName.toUpperCase().charAt(0)+fieldName.substring(1);
		try {
			cl.getMethod(getterName,null);
		} catch (SecurityException e) {
			e.printStackTrace();
		} catch (NoSuchMethodException e) {
			return true;
		}
		return false;
	}
	
}
